#include "clickedLabel.h"
#include <QMessageBox>

void ClickableLabel::mouseReleaseEvent(QMouseEvent *e)//释放
{
    if (checked)
    {
        checked = false;
    }
    else
    {
        checked = true;
    }

    setBackground();

    emit Clicked(this);
}

void ClickableLabel::mousePressEvent(QMouseEvent *e)  //按下
{
    //setStyleSheet("background-color:rgba(255,255,255,20)");
}

void ClickableLabel::setBackground()
{
    QString sty;

    if (checked)
    {
        sty="color:black;background-color:"+defaultColor;
    }
    else
    {
        sty="color:white;background-color:rgba(255,255,255,0);border:1px solid white;";
    }

    setStyleSheet(sty);

    update();
}
